package com.lagou.homework.third;

/**
 * 用户消费信息类
 */
public class ConsumeInfo {
    /**
     * 统计通话时长
     */
    private int time;

    /**
     * 统计上网流量
     */
    private double traffic;

    /**
     * 每月消费金额
     */
    private double monthlyCost;

    /**
     * 无参构造方法
     */
    public ConsumeInfo() {
    }

    /**
     * 有参构造方法
     * @param time          统计通话时长
     * @param traffic       统计上网流量
     * @param monthlyCost   每月消费金额
     */
    public ConsumeInfo(int time, double traffic, double monthlyCost) {
        setTime(time);
        setTraffic(traffic);
        setMonthlyCost(monthlyCost);
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        if (time >= 0) {
            this.time = time;
        } else {
            System.out.println("统计通话时长数值不合理");
        }
    }

    public double getTraffic() {
        return traffic;
    }

    public void setTraffic(double traffic) {
        if (traffic >= 0.0) {
            this.traffic = traffic;
        } else {
            System.out.println("统计上网流量数值不合理");
        }
    }

    public double getMonthlyCost() {
        return monthlyCost;
    }

    public void setMonthlyCost(double monthlyCost) {
        if (monthlyCost >= 0.0) {
            this.monthlyCost = monthlyCost;
        } else {
            System.out.println("每月消费金额数值不合理");
        }
    }
}
